//app.js

import NetWork from './utils/modules/NetWork';
App({
  onLaunch: function() {},
  globalData: {
    token: null,
    user: null,
    auth: true,
    _color: '#333',
    _background: '#fff',
    _serverPhone: '',
    // _baseUrl1: 'http://xc.fngc.shop/', 
    _baseUrl: 'https://xc.fngc.shop/', // 请求根
    _imgPath: '', // 图片根
    _host: '', // 域名
    _key: 'V3FBZ-RJSWU-I3WVP-2EGQV-7YHYK-YCBTB',
    _tabBar: {
      "color": "#7097A8",
      "selectedColor": "#7097A8",
      "backgroundColor": "#fff",
      "list": [
        {
          "pagePath": "pages/index/index",
          "text": "首页",
          "iconPath": "./images/home.png",
          "selectedIconPath": "./images/home1.png"
        },
        {
          "pagePath": "pages/personal/bespeak/bespeak",
          "text": "预约",
          "iconPath": "./images/mendian.png",
          "selectedIconPath": "./images/mendian1.png"
        },
        {
          "pagePath": "pages/personal/personal",
          "text": "我的",
          "iconPath": "./images/my.png",
          "selectedIconPath": "./images/my1.png"
        }

      ]},
      list: ['https://cms.macio.com.cn/assets/images/banner/20190424192323_SxF2LBJ1WT.jpg',
      'https://cms.macio.com.cn/assets/images/banner/20190424192323_SxF2LBJ1WT.jpg',
      'https://cms.macio.com.cn/assets/images/banner/20190424192323_SxF2LBJ1WT.jpg'
    ],
  },
  refreshtoken(token){
    var _that = this;
    console.log(token,"token");
    var net = new NetWork(_that.globalData._baseUrl);
    
    net._request({
      url: 'api/v1/member/refresh_token',
      data: { token: token },
      method: 'POST',
    }, '', res => {
      if (res.data.error_code == 0) {
        wx.setStorageSync("token", res.data.data);
      }
    })
  },
})